
var id = null ;
var flag = false;
var i = 0;

//图片轮播 ========================================================================
$(function(){

		playImg();
		$(".f").hover(function(){
			flag = true;
			$(".big").attr("src",this.src);

		});
		$(".f").mouseout(function(){
			flag = false;
			// playImg();
		});
})
	
function playImg() {
	
	var $imgs = $(".f");
	var $img = $(".big");
	id = setInterval(function(){
		if(flag){
			// console.log(123);
			// clearInterval(id);
			// console.log(id);
			// console.log(123);
		} else {
			// console.log(id);
			var path = $imgs[i].src;
			$img.attr("src",path);
			// console.log($imgs[i]);
			i++;
			if(i>4){
				i=0;
			}
		}
	},1500);

}

// function pause(){
// 	clearInterval(id);
// 	console.log(111);
// }

//景区介绍 ========================================================================

$(function(){
	$("th").click(function(){
		console.log(123);
		change(this);
	});
})
//动态的
function change(t){
	console.log(1);
	$(".great img").remove();
	$(".great a").remove();
	$(".great p").remove();
	var src;
	var arr = new Array();
	
	if(t.innerHTML=="当季热门"){
		src = "image/spain.jpg";
		var img = "<img src ='"+src+"'/>";
		arr[0] = "<a href=''><span>2.</span>法国巴黎浪漫之都</a>";
		arr[1] = "<a href=''><span>3.</span>巴西狂欢派对</a>";
		arr[2] = "<a href=''><span>4.</span>美国夏威夷风情</a>";
		var p = "<p ><span>1.</span>西班牙中世纪街道</p>";

	}else if(t.innerHTML=="特惠景点"){
		src= "image/newyork.jpg";
		var img = "<img src = '"+src+"'/>";
		arr[0] = "<a href=''><span>2.</span>杭州环湖航游</a>";
		arr[1] = "<a href=''><span>3.</span>天安门的盛发</a>";
		arr[2] = "<a href=''><span>4.</span>西藏喜雅拉马山</a>";
		var p = "<p ><span>1.</span>纽约世纪中心</p>";
	}else if(t.innerHTML=="参团游"){
		src= "image/italy.jpg";
		var img = "<img src ='"+src+"'/>";
		arr[0] = "<a href=''><span>2.</span>日本樱花飞舞</a>";
		arr[1] = "<a href=''><span>3.</span>韩国土肥牛</a>";
		arr[2] = "<a href=''><span>4.</span>埃及金字塔</a>";
		var p = "<p ><span>1.</span>意大利环岛</p>";
	}
	$(".great").append(img,p,arr[0],arr[1],arr[2]);
	var $t1 = $(".great img");
	var $t2 = $(".great p");
	fadeinout($t1,$t2);//jquery一旦取值只代表哪一个对象，一旦删除即消失，需要重新赋值


}

// $(document).ready(function(){
//   $(".btn1").click(function(){
//   $("p").fadeOut()
//   });
//   $(".btn2").click(function(){
//   $("p").fadeIn();
//   });
// });



//第一次加载页面复制
$(function(){
	var $t1 = $(".great img");
	var $t2 = $(".great p");
	fadeinout($t1,$t2);

})

function fadeinout(t1,t2){
	t1.hover(function(){
		t2.fadeIn(1000);
	});
	t1.mouseleave(function(){
		t2.fadeOut(1000);
	})
}


// 公告栏移动=====================================================
$(function(){
	$(".move").click(function(){
		move();
	})
})
function move(){
	var li = $(".youji li:eq(2)");

		console.log(li.css("30px"));
}


//版权区域 ================================================================
$(function(){

	$(".link img").hover(function(){
		var src= "";
		var value = this.getAttribute("value");
		if(value==1){
			src="image/baidu.png";
		}else if(value==2){
			src="image/qunaer.png";
		}else if(value==3){
			src="image/tuniu.png";
		}else{
			src="image/xiecen.png";
		}
		this.setAttribute("src",src);
	});

		$(".link img").mouseleave(function(){
		var src= "";
		var value = this.getAttribute("value");
		if(value==1){
			src="image/baidu0.png";
		}else if(value==2){
			src="image/qunaer0.png";
		}else if(value==3){
			src="image/tuniu0.png";
		}else{
			src="image/xiecen0.png";
		}
		this.setAttribute("src",src);
	});
})


